package com.xiao.hao.config;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * @Desciption:
 * @Author: 郑焱军
 * @Date: 2022/9/22 11:18
 */
public class UserConfig {

    public static Long getUserId() {
        return RequestDataHelper.getRequestData("userId");
    }


    public static String getUserName() {
        return RequestDataHelper.getRequestData("userName");
    }

    public static Long getMerchantId() {
        return RequestDataHelper.getRequestData("merchantId");
    }

    public static String getToken() {
        HttpServletRequest request =
                ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
        return request.getHeader("Authorization");
    }

}
